﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FF14TreasureDiggingTool.Views.Windows;
using System.Windows.Input;
using Wpf.Ui.Common.Interfaces;
using Wpf.Ui.Demo.Services.Contracts;

namespace FF14TreasureDiggingTool.ViewModels;

public partial class DashboardViewModel : ObservableObject, INavigationAware
{
    private readonly IShowWindowService _showWindowService;

    private ICommand _openWindowCommand;

    public ICommand OpenWindowCommand =>
        _openWindowCommand ??= new RelayCommand<string>(OnOpenWindow);

    public DashboardViewModel(IShowWindowService showWindowService)
    {
        _showWindowService = showWindowService;
    }

    public void OnNavigatedTo()
    { }

    public void OnNavigatedFrom()
    { }

    private void OnOpenWindow(string parameter)
    {
        switch (parameter)
        {
            case "open_window_store":
                _showWindowService.Show<CustomRuleWindow>();
                return;

            case "open_window_task":
                _showWindowService.Show<TaskManagerWindow>();
                return;

            case "open_window_tutorial":
                _showWindowService.Show<TutorialWindow>();
                return;
        }
    }
}